#ifndef _TRACE_INCLUDED
#define _TRACE_INCLUDED

#ifdef __cplusplus
extern "C" {
#endif

void Trace(const char * lpszFormat, ...);
void TraceLastError(void);

#ifdef _DEBUG

#define TRACE	 Trace
#define TRACELASTERROR TraceLastError

#else

#define TRACE    1 ? (void)0 : Trace
#define TRACELASTERROR 1 ? (void)0 : TraceLastError

#endif


//Then, inside my source code modules, I place a message to myself like this:
//#pragma chMSG(Add error checking here later)

#define chSTR(x)           #x
#define chSTR2(x)        chSTR(x)
#define MESSAGE(desc) message(__FILE__ "("\
    chSTR2(__LINE__) ") : message : " #desc)

#ifdef __cplusplus
}
#endif

#endif